package com.wjjm.spoonselling.util;

public class Result {

    private Object data;
    private int code;
    private String msg;

    /**
     * 三个构造方法
     */
    public Result() {
    }

    ;

    public Result(int code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Result(int code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    /**
     * getter、setter方法
     */
    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static Result fail(String msg) {
        return new Result(500, null, msg);
    }

    public static Result success() {
        return new Result(200, null, "请求成功");
    }

    public static Result success(Object data) {
        return new Result(200, data, "请求成功");
    }
}
